package graph.element.axe;
import graph.GraphPanel;
import graph.label.Direction;
import graph.label.Label;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.util.ArrayList;
import data.Dimensions;

public class Ordonnee extends Axe {
	public Ordonnee(GraphPanel graphingData, boolean decal, int x, int y, int x2, int y2, Dimensions Dimensions) {
		super(graphingData, decal, x, y, x2, y2, Dimensions);
	}

	protected ArrayList<Label> genLabels(Dimensions Dimensions) {
		int x = getX();
		int y = getY();
		this.Labels = new ArrayList<Label>();
		for (String label: Dimensions) {
			y -= INC;
			if (decal) {
				this.Labels.add(new Label(graphingData, x, y + INC/2, Direction.LEFT, label));
			} else {
				this.Labels.add(new Label(graphingData, x, y, Direction.LEFT, label));
			}
			
		}
		return this.Labels;
	}

	protected void drawTicks() {
		Graphics g = graphingData.getG();
		Graphics2D g2 = (Graphics2D)g;
		int x = getX();
		int y = getY();
		for(int i = 0; i < Labels.size(); i++) {
			y -= INC;
			if (decal) {
				g2.draw(new Line2D.Double(x, y + INC/2, x-SPACE, y + INC/2));
			} else {
				g2.draw(new Line2D.Double(x, y, x-SPACE, y));
			}
		}
	}
}
